package copy_file;

import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.IoUtil;

import java.io.*;

public class Tets {
    public static void main(String[] args) throws IOException {
/*        FileInputStream fis=new FileInputStream("H:\\javabase_ws2\\java_advance\\Day10_file_io\\src\\copy_file\\a.txt");
        FileOutputStream fos=new FileOutputStream("H:\\javabase_ws2\\java_advance\\Day10_file_io\\src\\copy_file\\b.txt");
        byte[] bytes=new byte[1024];
        int len=-1;
        while((len=fis.read(bytes))!=-1){
            fos.write(bytes,0,len);
        }
        fos.close();
        fis.close();
        System.out.println("复制完成");*/

        FileUtil.copy("H:\\\\javabase_ws2\\\\java_advance\\\\Day10_file_io\\\\src\\\\copy_file\\\\a.txt",
                "H:\\\\javabase_ws2\\\\java_advance\\\\Day10_file_io\\\\src\\\\copy_file\\\\a.txt",true);

/*        IoUtil.copy(FileUtil.file("D:\\java\\java_code\\Day10_file_io\\src\\copy_file\\a.txt"),
                new FileOutputStream("D:\\java\\java_code\\Day10_file_io\\src\\copy_file\\c.txt"),true);*/
        System.out.println("复制成功");
    }
}
